﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace LambdaToSql.Interface
{
    /// <summary>
    /// 添加接口
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IInsertable<T>
    {
        /// <summary>
        /// 数据库上下文对象
        /// </summary>
        LambdaToSql.EntityModel.DbContext Context { get; set; }

        /// <summary>
        /// 添加实体对象
        /// </summary>
        IInsertable<T> Insert(T obj);

        /// <summary>
        /// 插入列
        /// </summary>
        /// <param name="exp"></param>
        /// <returns></returns>
        IInsertable<T> InsertColumns(Expression<Func<T, object>> exp);

        /// <summary>
        /// 忽略插入列
        /// </summary>
        /// <param name="exp"></param>
        /// <returns></returns>
        IInsertable<T> IgnoreColumns(Expression<Func<T, object>> exp);

        /// <summary>
        /// 执行插入 
        /// <para>支持int自增,uniqueidentifier</para>
        /// <para>返回主键列值</para>
        /// </summary>
        /// <returns>返回主键列值</returns>
        string ExecuteNonQuery();

        /// <summary>
        /// 执行插入 
        /// <para>支持int自增,uniqueidentifier</para>
        /// </summary>
        /// <returns>返回debug信息</returns>
        LambdaToSql.EntityModel.Result<string> ExecuteNonQuery(bool debug);
    }
}
